home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 3863 / 3863.xpi / chrome / imacros.jar / content / iOpusOverlay.js < prev    next >
Text File  |  2010-01-25  |  2KB  |  5 lines

  1.  
  2. /*
  3. (c) Copyright 2007 iOpus Software GmbH - http://www.iopus.com
  4. */
  5. var iOpusClient={m_connector:null,get connector(){return this.m_connector;},set connector(val){this.m_connector=val;},QueryInterface:function(aIID){if(!aIID.equals(imns.Ci.IOpusConnectorEvents)&& !aIID.equals(imns.Ci.nsITimerCallback)&& !aIID.equals(imns.Ci.nsISupports)){throw Components.results.NS_ERROR_NO_INTERFACE;}return this;},OnCommandPending:function(cookie,commandName,param){var dummy;try{switch(commandName){case 'appEnd':window.close();break;case 'appSendText':showtext(param,this.m_connector,cookie);break;case 'PLAY':showmacro(param,this.m_connector,cookie);break;case 'IIMSCREENSHOT':SI_takeScreenshot(param,this.m_connector,cookie);break;default:this.m_connector.CompleteCommand(cookie,-1,"Attempt to execute unsupported command");break;}}catch(e){Components.utils.reportError(e);}},Shutdown:function(){try{this.m_connector.Shutdown();}catch(e){Components.utils.reportError(e);}}};var iOpusOverlay={onLoad:function(){try{if(!window.arguments)return;var params=this.getParams(window.arguments[0]);if(!params){params={authorizeAll:false,pipeUuid:"",creatorUuid:""}}this.init(params.authorizeAll,params.pipeUuid,params.creatorUuid);}catch(e){Components.utils.reportError(e);}},onUnload:function(){if(iOpusClient.connector){iOpusClient.connector.Shutdown();iOpusClient.connector=null;}},init:function(authorizeAll,pipeUuid,creatorUuid){try{var connector;try{connector=imns.Cc["@iOpus.com/OpusConnector"].createInstance(imns.Ci.IOpusConnector);}catch(e){return;}iOpusClient.connector=connector;connector.Start(authorizeAll,pipeUuid,creatorUuid,iOpusClient,window.document);}catch(e){Components.utils.reportError(e);}},getParams:function(url){if(!url)return null;if(/nsISupportsArray/.test(url.toString())){url=url.GetElementAt(0);}url=url.toString();var re="authorizeAll=(true|false)"+"&pipeUuid=([-\\w]+)"+"&creatorUuid=([-\\w]+)";var match=url.match(new RegExp(re,"i"));if(!match)return null;var params={authorizeAll:/^true$/i.test(match[1]),pipeUuid:match[2],creatorUuid:match[3]};return params;},handleEvent:function(evt){if(evt.type=="load"){this.onLoad();window.removeEventListener("load",this,false);}else if(evt.type=="unload")this.onUnload();}};window.addEventListener("load",iOpusOverlay,false);window.addEventListener("unload",iOpusOverlay,false);